// redis 服务器连接配置
const redis = require("redis")
const { REDIS_CONF } = require("../config/db")

// start redis server: redis-server.exe redis.windows.conf
// use redis: redis-cli.exe -h 127.0.0.1 -p 6379

// 可能会遇到的问题
// ClientClosedError: The client is closed
// 处理方法
// 版本回退 npm install --save redis@3.1.2

const redisClient = redis.createClient(REDIS_CONF.port, REDIS_CONF.host)
redisClient.on("error", error => {
  console.log(error);
})

module.exports = redisClient
